package com.Rsoft.goodWebsocketMan.Thread;

import com.Rsoft.goodWebsocketMan.handler.MyServerHandler;
import lombok.Data;
import lombok.SneakyThrows;
import org.glassfish.tyrus.server.Server;

@Data
public class WebSocketServerThread extends Thread {
    private volatile int port ;
    private volatile Server server ;
    private volatile boolean flag = true;
    @SneakyThrows
    @Override
    public void run() {
        Server server = new Server("127.0.0.1",port,"",null, MyServerHandler.class);
        server.start();
        this.server = server;
        while (flag){
            Thread.sleep(1000);
        }
        server.stop();
    }
}

